package org.song.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.song.model.vo.common.BaseVo;

import java.net.URL;
import java.util.Date;
import java.util.List;

@ApiModel("博客实体类")
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@Alias(value = "Blog")
public class Blog extends BaseVo {

    @ApiModelProperty(value = "博客主键" , notes = "博客主键")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    @ApiModelProperty(value = "博客标题" , notes = "博客标题")
    private String title;

    @ApiModelProperty(value = "创建人Id" , notes = "创建人Id")
    private Long creatorId;

    @ApiModelProperty(value = "博客内容" , notes = "博客内容")
    private String content;

    @ApiModelProperty(value = "创建时间" , notes = "创建时间")
    @JsonFormat(pattern = TIME_FORMAT_PATTERN)
    private Date createTime;

    @ApiModelProperty(value = "首页图片路径" , notes = "首页图片路径")
    private String firstPicture;

    @ApiModelProperty(value = "点赞数" , notes = "点赞数")
    private Integer thumbs;

    @ApiModelProperty(value = "完成状态 0: 完结 1: 草稿" , notes = "完成状态")
    private Byte flag;

    @ApiModelProperty(value = "发布状态" , notes = "发布状态")
    private Byte published;

    @ApiModelProperty(value = "归档状态" , notes = "归档状态")
    private Byte archive;

    @ApiModelProperty(value = "评论状态" , notes = "评论状态")
    private Byte commentable;

    @ApiModelProperty(value = "赞赏状态" , notes = "赞善状态")
    private Byte appreciation;

    @ApiModelProperty(value = "版权类型" , notes = "版权类型")
    private Byte shareStatement;

    @ApiModelProperty(value = "更新时间" , notes = "更新时间")
    @JsonFormat(pattern = TIME_FORMAT_PATTERN)
    private Date updateTime;

    @ApiModelProperty(value = "浏览次数" , notes = "浏览次数")
    private Long views;

    @ApiModelProperty(value = "摘要" , notes = "摘要")
    private String description;

    @ApiModelProperty(value = "博客删除标记" , notes = "博客删除标记")
    private Integer deleted;

    @ApiModelProperty(value = "对应的博客类型实体类型" , notes = "对应的博客类型实体")
    private Type type;

    @ApiModelProperty(value = "博客对应的标签集合" , notes = "博客对应的标签集合")
    private List<Tag> tags;

    @ApiModelProperty(value = "创建人" , notes = "创建人")
    private User creator;

    @ApiModelProperty( value = "博客主图URL" , notes = "博客主图URL" )
    private URL firstPictureUrl;

    @ApiModelProperty( value = "博客评论数")
    private Integer commentCount;

    @ApiModelProperty( value = "博客收藏数")
    private Integer collectCount;

    @ApiModelProperty( value = "博客打赏数")
    private Integer rewardCount;

    @ApiModelProperty( value = "数据库乐观锁字段")
    private Integer version;

    /**
     * 发布状态
     */
    public enum Flag {
        RELEASE((byte) 0 , "完结"),
        DRAFT((byte) 1 , "草稿")
        ;
        private Byte code;
        private String msg;

        Flag(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 博客版权类型
     */
    public enum ShareStatementEnum {
        ORIGINAL( (byte) 1 ,"原创" ),
        REPRINT( (byte) 2 , "转载" ),
        TRANSLATE( (byte) 3  , "翻译" )
        ;
        private Byte code;
        private String msg;

        ShareStatementEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 博客发布状态
     */
    public enum PublishStatusEnum {
        PUBLISHED((byte) 0 , "已发布"),
        UNPUBLISHED((byte) 1 , "未发布")
        ;
        private Byte code;
        private String msg;

        PublishStatusEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 博客归档状态
     */
    public enum ArchiveEnum {
        YES((byte) 0 , "是"),
        NO((byte) 1 , "否")
        ;
        private Byte code;
        private String msg;

        ArchiveEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 博客评论状态
     */
    public enum CommentAbleEnum {
        COMMENTABLE((byte) 0 , "开启"),
        UN_COMMENTABLE((byte) 1 , "关闭")
        ;
        private Byte code;
        private String msg;

        CommentAbleEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * 博客赞赏状态
     */
    public enum AppreciationEnum {
        APPRECIATION((byte) 0 , "开启"),
        UN_APPRECIATION((byte) 1 , "关闭")
        ;
        private Byte code;
        private String msg;

        AppreciationEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public void setCode(Byte code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

}
